package com.kuang.service;

import com.kuang.dao.BookMapper;
import com.kuang.pojo.Books;
import com.kuang.pojo.Movies;
import com.kuang.pojo.Users;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @auther liuyang
 * @create 2021-10-24-19:06
 */
public class BookServiceImpl implements BookService{

    //调用dao层的操作，设置一个set接口，方便Spring管理
    private BookMapper bookMapper;

    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    public int addBook(Books book) {
        return bookMapper.addBook(book);
    }

    public int deleteBookById(int id) {
        return bookMapper.deleteBookById(id);
    }

    public int updateBook(Books books) {
        return bookMapper.updateBook(books);
    }

    public Books queryBookById(int id) {
        return bookMapper.queryBookById(id);
    }

    public List<Books> queryAllBook() {
        return bookMapper.queryAllBook();
    }

    @Override
    public List<Movies> getMovies() {
        return bookMapper.getMovies();
    }

    @Override
    public List<Movies> searchMovies(String movie) {

        return bookMapper.searchMovies(movie);
    }

    @Override
    public Users testLogin(@Param("username") String username,@Param("password") String password) {
        return bookMapper.testLogin(username,password);
    }

}
